from loguru import logger

# class Student(object):
#
#     def __init__(self,name,score):
#         self.__name = name
#         self.__score = score
#
#     @property
#     def score(self):
#         logger.info(f"{self.__name} score is {self.__score}")
#         return self.__score
#
#     @score.setter
#     def score(self,score):
#         if isinstance(score,int) and 0 < score <= 100:
#             self.__score = score
#         else:
#             raise ValueError("数据错误")
# yuan = Student('yuan',88)
#
# # print(yuan.get_score())
# print(yuan.score)
# yuan.score = 100
# print(yuan.score)

class Student(object):

    def __init__(self,name,score):
        self.__name = name
        self.__score = score

    def __get_score(self):
        return self.__score

    def __set_score(self, score):
        if isinstance(score,int) and 0 < score <= 100:
            self.__score = score
        else:
            raise ValueError("数据错误")

    score = property(__get_score,__set_score)
yuan = Student('yuan',88)

# print(yuan.get_score())
print(yuan.score)
yuan.score =98
print(yuan.score)